home *** CD-ROM | disk | FTP | other *** search
- code segment para
- assume cs:code,ds:code
- org 100h
- intrcpt proc far
- jmp init
- test db 0 ;Drive to intercept on
- got db 0 ;Drive being accessed
- got1 db 0 ;The second character ( normally : )
- even
- temp dw 0
- x40off dw 0 ;Offset for INT 40H
- x40seg dw 0 ;Segment of INT 40H
- x2foff dw 0 ;Offset for INT 2FH
- x2fseg dw 0 ;Segment for INT F1H
- x21off dw 0 ;Offset for INT 21H
- x21seg dw 0 ;Segment for INT 21H
- flag dw 0 ; Operation flag
- ;
- ; Interrupt 21H Code
- ;
- x21int: push ax
- push bx
- push cx
- push dx
- push ds
- mov dx,cs
- mov ds,dx
- cmp ax,440dh ;Secret IOCTL!
- je x211
- jmp x21out
- ;
- x211: mov al,test ;Convert letter to drive number
- sub al,96
- cmp al,bl ;Is this for the proper drive?
- jne x21out ;No
- mov ax,40h ;Address of Diskette State Machine
- mov ds,ax
- mov bx,90h
- xb: mov al,54h ;Set the STATE for Quad/FM/Single step
- mov ds:[bx],al ;Store it away to FOOL the BIOS
- mov cs:flag,1 ;Set the operation to bypass INT40H check
- push ax
- push bx
- push cx
- push dx
- push es
- push ds
- push si
- mov ax,cs ;Do a VERIFY to the last recorded cyl
- mov ds,ax ;So that all will be well within the BIOS
- mov es,ax ;This is necessay for DISKCOPY and
- xa: lea bx,temp ;DISKCOMP to work
- mov cl,1
- mov dx,40h
- mov si,94h
- push ds
- mov ds,dx
- mov ch,ds:[si]
- pop ds
- mov ah,4
- mov al,1
- xor dx,dx
- int 40h ;The actual VERIFY operation
- xaout: xor ax,ax
- mov cs:flag,ax
- pop si
- pop ds
- pop es
- pop dx
- pop cx
- pop bx
- pop ax
- ;
- ;
- mov al,54h
- mov ds:[bx],al ;Reload the STATE MACHINE to be safe
- x21out: pop ds
- pop dx
- pop cx
- pop bx
- pop ax
- jmp dword ptr cs:[x21off] ; LONG jump to the actual INT
- ;
- ; INTERRUPT 40H code
- ;
- x40int: push ax
- push bx
- push cx
- push dx
- push ds
- pushf
- mov ax,cs
- mov ds,ax
- cmp flag,1 ;Is this a special operation from the
- je x2 ;INT 21H service routine?
- mov ah,'a' ;Are we back to DRIVE A?
- mov al,got
- cmp ah,al
- jne x1 ;Yes, if a colon follows
- mov ah,':'
- mov al,got1
- cmp ah,al
- jne x2 ;Is it A: ?
- mov ax,40h
- mov bx,90h
- mov ds,ax
- mov dl,ds:[bx]
- mov dh,0f0h
- and dl,dh
- cmp dl,50h ;If it's 5X then set 61H in STATE
- jne x2 ;Machine
- mov dl,61h
- mov ds:[bx],dl
- x2: jmp x40out
- x1: mov ah,test ;Are we talking to the correct drive?
- mov al,got
- cmp ah,al
- jne x40out ;Not the proper drive letter
- mov ah,':'
- mov al,got1
- cmp ah,al
- jne x40out ;No colon
- mov dl,0dfh ;The single step mask
- mov ax,40h ;Segment
- mov ds,ax
- mov bx,90h ;40:90 is the address
- mov dh,ds:[bx]
- and dh,dl ;Mask out the double step bit
- mov ds:[bx],dh ;Store it back
- x40out: popf
- pop ds
- pop dx
- pop cx
- pop bx
- pop ax
- jmp dword ptr cs:[x40off] ;Do the REAL INT 40H
- ;
- ; Interrupt 2Fh
- ;
- x2fint: push ax
- push bx
- push cx
- push dx
- push ds
- pushf
- cmp ah,17 ;Is it the proper 2F Function?
- jne x2fout ;No
- cmp al,35
- jne x2fout
- mov bx,ds:[si] ;SECRET STUFF!
- mov ax,cs
- mov ds,ax
- cmp bh,':'
- jne x2fout
- cmp bl,90
- ja x2f1
- mov ch,bh
- xor bh,bh
- add bx,32
- mov bh,ch
- x2f1: mov got,bl
- mov got1,bh
- x2fout: popf
- pop ds
- pop dx
- pop cx
- pop bx
- pop ax
- jmp dword ptr cs:[x2foff] ;Continue the 2F chain
- dw 0
- table dw 0
- init: push es
- mov ax,0ffffh
- mov es,ax
- mov bx,0eh
- mov al,es:[bx] ;Check to see if this is an AT
- cmp al,0fch ;AT code
- je ini1
- mov ah,9
- lea dx,messat
- int 21h
- xor ax,ax
- int 21h
- ini1: mov ah,30h
- int 21h ;Check for proper DOS
- cmp al,3
- jae i1
- jmp badv
- i1: cmp ah,14
- jae i2
- badv: mov ah,9
- lea dx,messv
- int 21h
- xor ax,ax
- int 21h
- i2: mov al,10h
- out 70h,al ;Check to see if drive A is 1.2 megger
- in al,71h
- mov ah,0f0h ;Mask
- and al,ah
- cmp al,20h
- je i3 ;Yes it is a 1.2 megabyte floppy drive
- lea dx,messd
- mov ah,9
- int 21h
- xor ax,ax
- int 21h
- i3: mov bx,80h ;PSP address
- mov al,[bx] ;Byte count
- cmp al,0
- jne i5
- i4: mov ah,9
- lea dx,messn
- int 21h
- xor ax,ax
- int 21h
- i5: inc bx
- mov al,[bx]
- cmp al,32
- je i5
- cmp al,13
- je i4
- cmp al,90
- ja i6
- xor ah,ah
- add ax,32
- i6: cmp al,100
- jb i7
- cmp al,122
- ja i7
- jmp i8
- i7: mov ah,9
- lea dx,messp
- int 21h
- xor ax,ax
- int 21h
- i8: mov test,al
- cli ;Start the vector swapping
- mov cx,cs
- xor ax,ax
- mov flag,ax
- mov es,ax
- mov bx,256 ;INT40H
- mov ax,es:[bx]
- mov x40off,ax
- mov ax,offset x40int
- mov es:[bx],ax
- add bx,2
- mov ax,es:[bx]
- mov x40seg,ax
- mov es:[bx],cx
- mov bx,188 ;INT2F
- mov ax,es:[bx]
- mov x2foff,ax
- mov ax,offset x2fint
- mov es:[bx],ax
- add bx,2
- mov ax,es:[bx]
- mov x2fseg,ax
- mov es:[bx],cx
- mov bx,132 ;INT21
- mov ax,es:[bx]
- mov x21off,ax
- mov ax,offset x21int
- mov es:[bx],ax
- add bx,2
- mov ax,es:[bx]
- mov x21seg,ax
- mov es:[bx],cx
- sti ;Vectors are swapped
- mov ah,9
- lea dx,messg
- int 21h
- mov dx,offset table ;All that has to be resident
- int 27h ;Stay resident
- messat db 'The computer is NOT an IBM-AT',13,10,'$'
- messv db 'Wrong DOS Version ---- Must be 3.2 or above'
- db 13,10,'$'
- messd db 'Drive A is NOT a high capacity drive'
- db 13,10,'$'
- messn db 'Requires NEW drive letter that DRIVER.SYS '
- db 'generated',13,10,'$'
- messp db 'Invalid drive specifier'
- db 13,10,'$'
- messg db 'Alpha Computer Service INTERCEPT is now loaded'
- db 13,10,'$'
- intrcpt endp
- code ends
- end intrcpt